package it.abc.sicsic.model.skipper;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@NamedQueries({
  @NamedQuery(name = "Skipper.findAll", query = "select o from Skipper o")
})
@Table(name = "\"skipper\"")
public class Skipper implements Serializable {
    
    public final static String FIND_BARCHE = 
        "SELECT * FROM SKIPPER " +
        "WHERE (NOME LIKE ? OR ? IS NULL) " +
        "AND (RESIDENZA LIKE ? OR ? IS NULL)";
    
    @Id
    @Column(name="id", nullable = false)
    private int id;
    @Column(name="natoA")
    private String natoA;
    @Column(name="natoIl")
    private String natoIl;
    @Column(name="nome")
    private String nome;
    @Column(name="numPatenteNautica")
    private String numPatenteNautica;
    @Column(name="residenza")
    private String residenza;
    @Column(name="rilasciataDa")
    private String rilasciataDa;

    public Skipper() {
    }

    public Skipper(int id, String natoA, String natoIl, String nome, String numPatenteNautica, String residenza,
                   String rilasciataDa) {
        this.id = id;
        this.natoA = natoA;
        this.natoIl = natoIl;
        this.nome = nome;
        this.numPatenteNautica = numPatenteNautica;
        this.residenza = residenza;
        this.rilasciataDa = rilasciataDa;
    }


    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getNatoA() {
        return natoA;
    }

    public void setNatoA(String natoA) {
        this.natoA = natoA;
    }

    public String getNatoIl() {
        return natoIl;
    }

    public void setNatoIl(String natoIl) {
        this.natoIl = natoIl;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getNumPatenteNautica() {
        return numPatenteNautica;
    }

    public void setNumPatenteNautica(String numPatenteNautica) {
        this.numPatenteNautica = numPatenteNautica;
    }

    public String getResidenza() {
        return residenza;
    }

    public void setResidenza(String residenza) {
        this.residenza = residenza;
    }

    public String getRilasciataDa() {
        return rilasciataDa;
    }

    public void setRilasciataDa(String rilasciataDa) {
        this.rilasciataDa = rilasciataDa;
    }

    @Override
    public String toString() {
        StringBuffer buffer = new StringBuffer();
        buffer.append(getClass().getName()+"@"+Integer.toHexString(hashCode()));
        buffer.append('[');
        buffer.append("id=");
        buffer.append(getId());
        buffer.append(',');
        buffer.append("natoA=");
        buffer.append(getNatoA());
        buffer.append(',');
        buffer.append("natoIl=");
        buffer.append(getNatoIl());
        buffer.append(',');
        buffer.append("nome=");
        buffer.append(getNome());
        buffer.append(',');
        buffer.append("numPatenteNautica=");
        buffer.append(getNumPatenteNautica());
        buffer.append(',');
        buffer.append("residenza=");
        buffer.append(getResidenza());
        buffer.append(',');
        buffer.append("rilasciataDa=");
        buffer.append(getRilasciataDa());
        buffer.append(']');
        return buffer.toString();
    }
}
